import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {Charts} from "../../../../_mock/charts";
import {Globals} from "../../globals";
import {BaseService} from "../../shared/service/base.service";
import {ApiUrl} from "../../config/api-url";
import {ContractComponent} from './contract/contract.component';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.less']
})
export class HomeComponent implements OnInit {

  isVisible = false;
  @ViewChild('contractComponent')
  contractComponent: ContractComponent;

  isMobile = Globals.isMobile();
  userInfo:any = {
    roleId : 0
  };
  constructor(private baseService: BaseService) {
    this.findUserInfo();

  }

  ngOnInit(): void {

  }

  findUserInfo(){
    this.baseService.get(ApiUrl.UserUrl + "/userInfo").subscribe(res => {
      if(res.data){
        this.userInfo = res.data;
        if (this.userInfo.roleId == 2 && (this.userInfo.signStatus == null || !this.userInfo.signStatus)) {
          this.isVisible = true;
        }
      }
    })
  }

  settingContract($event: any) {
    this.isVisible = $event;
  }

}
